package initialize

// PresetDependencies 预定义的服务依赖配置
var PresetDependencies = map[string]ServiceDependencies{
	"gateway": {
		Database: true,
		Redis:    true,
		MongoDB:  false,
		Logger:   true,
		Config:   true,
	},
	"agent": {
		Database: true,
		Redis:    true,
		MongoDB:  false,
		Logger:   true,
		Config:   true,
	},
	"mcp": {
		Database: true,
		Redis:    true,
		MongoDB:  false,
		Logger:   true,
		Config:   true,
	},
	"rag": {
		Database: true,
		Redis:    true,
		MongoDB:  true, // RAG服务可能需要MongoDB存储文档
		Logger:   true,
		Config:   true,
	},
}

// GetServiceDependencies 获取服务的依赖配置
func GetServiceDependencies(serviceName string) ServiceDependencies {
	if deps, exists := PresetDependencies[serviceName]; exists {
		return deps
	}

	// 默认配置：包含基本的配置和日志
	return ServiceDependencies{
		Database: false,
		Redis:    false,
		MongoDB:  false,
		Logger:   true,
		Config:   true,
	}
}

// InitializeService 使用预定义配置初始化服务
func InitializeService(serviceName string) (*InitResult, error) {
	deps := GetServiceDependencies(serviceName)
	return Initialize(serviceName, deps)
}

// InitializeWithCustomDeps 使用自定义依赖配置初始化服务
func InitializeWithCustomDeps(serviceName string, customDeps ServiceDependencies) (*InitResult, error) {
	return Initialize(serviceName, customDeps)
}
